﻿//热力
var hours_3 = ['其他检验', '全面检验', '安装监检', '年度检验', '委托检验','制造监检', '耐压试验', '进口监检'];
var days_3 = ['1级', '2级', '3级', '4级', '5级', '不合格', '合格', '监督运行', '其他', '停止运行', '修理后复检', '允许使用', '整改后使用'];
var data1_3 = [];
var datav_3 = [0, 0, 0, 0, 0, 33, 89568, 0, 561, 0, 0, 0, 0, 5031, 20530, 21337, 654, 21, 113, 13705, 3, 792, 1, 26, 3292, 73, 0, 0, 0, 0, 0, 0, 0, 0, 52156, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1446, 940, 2081, 86, 0, 3832, 0, 0, 0, 0, 0, 0, 1, 3918, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2606, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0]
for (var z = 0; z < hours_3.length; z++) {

    for (var i = 0; i < days_3.length; i++) {
        data1_3.push([i, z, datav_3[i+z*days_3.length]]);
    }
}
data1_3 = data1_3.map(function(item) {
    return [item[1], item[0], item[2] || '-'];
});

option = {
    // dataZoom: [
    //
    //     {
    //         id: 'dataZoomY',
    //         type: 'slider',
    //         yAxisIndex: [0],
    //         startValue:0,
    //         endValue:100,
    //         filterMode: 'empty',
    //         // textStyle: {
    //         //     color: '#fff',
    //         // }
    //     }
    // ],
    tooltip: {
        position: 'top',
        formatter: function(params) {
            var sum = 0;
            for(var x=0;x<datav_3.length;x++){
                sum = sum + datav_3[x]
            }
            // return '检验结论：' + days_3[params.value[1]] + '<br/>' + '数量：' + params.data[2];
            return '检验结论：' + days_3[params.value[1]] + '<br/>' + '数量：' + params.data[2]+ '<br>' + '占比：' + (params.data[2] / sum * 100).toFixed(2) + '%，总数:'+sum;;
        }
    },
    animation: false,
    grid: {
        left: '3%',
        right: '8%',
        bottom: '8%',
        containLabel: true
    },
    xAxis: {
        type: 'category',
        data: hours_3,
        axisLine : {
            lineStyle : {
                color : '#fff'
            }
        },
        axisLabel: {
            interval:0,
            rotate:40,
            textStyle: {
                color: '#fff',
                fontSize: 16,
            },
        } ,
        nameTextStyle:{
            color: '#fff',
            fontSize: 16,
        },
        splitArea: {
            show: true
        },
        name: '检验类别'
    },
    yAxis: {
        type: 'category',
        data: days_3,
        axisLine : {
            lineStyle : {
                color : '#fff'
            }
        },
        nameTextStyle:{
            color: '#fff',
            fontSize: 16,
        },
        axisLabel: {
            interval:0,
            rotate:40
            ,
            textStyle: {
                color: '#fff',
                fontSize: 16,
            },
        } ,
        splitArea: {
            show: true
        },
        name: '检验结论'
    },
    visualMap: {
        min: 1,
        max: 5000,
        calculable: true,
        orient: 'horizontal',
        left: 'center',
        bottom: '1%',
        text: ['5000','1'],// 文本，默认为数值文本
        //color:['#20a0ff','#D2EDFF'],
        calculable: false,
        color: [
            '#dd413b', '#fec42c', '#80F1BE'
        ],
        textStyle: {
            fontSize: 16,
            color: '#fff',
        }
    },
    series: [{
        name: 'Punch Card',
        type: 'heatmap',
        data: data1_3,
        label: {
            normal: {
                show: true
            }
        },
        itemStyle: {
            emphasis: {
                shadowBlur: 10,
                shadowColor: 'rgba(120, 0, 0, 0.5)'
            }
        }
    }]
};
